{extend name="common/adminBase" /}
{block name="body"}
<body>
<style>
    .r{
        float: right;
    }
</style>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form class="layui-form layui-col-space5">
                        <div class="layui-inline layui-show-xs-block r">
                            <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
                        </div>
                        <div class="layui-inline layui-show-xs-block r">
                            <input type="text" name="name" value="{:input('name')}" placeholder="请输入课题名称" autocomplete="off" class="layui-input">
                        </div>

                        <a class="layui-btn " onclick="xadmin.open('添加课题','addclass',800,600)"><i class="layui-icon"></i>添加</a>
                    </form>

                </div>

                <div class="layui-card-body layui-table-body layui-table-main">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>课题名称</th>
                            <th>状态</th>

                            <th>创建时间</th>
                            <!--<th>是否需要第二申请人</th>-->
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {volist name="data" id="v"}
                        <tr>
                            <td>{$v.id}</td>
                            <td>{$v.name}</td>
                            <td>{if $v.status==0}不公开{else/}公开{/if}</td>
                            <td>{$v.time|date="Y-m-d"}</td>
                            <!--<td>{if $v.if_two==1}需要{else/}不需要{/if}</td>-->
                            <td class="td-manage">
                                <a class="layui-btn layui-btn layui-btn-xs"  onclick="xadmin.open('编辑','editclass/?id={$v.id}',800,600)" >
                                    <i class="layui-icon">&#xe642;</i>编辑
                                </a>
                                <a class="layui-btn layui-btn layui-btn-xs"  href="/index/classcontroller/member?id={$v.id}" >
                                    <i class="layui-icon">&#xe642;</i>查看成员
                                </a>
                                <button class="layui-btn-danger layui-btn layui-btn-xs"  onclick="member_del({$v.id})" href="javascript:;" >
                                    <i class="layui-icon">&#xe640;</i>删除
                                </button>
                            </td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    <div class="page">
                        <div>
                           <?php echo $page?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    layui.use('form', function(){
        var  form = layui.form;
    });

    /*用户-停用*/
    function member_del(id){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                url:'delclass',
                data:{id:id},
                type:'post',
                dataType:'json',
                success:function (res) {
                    if (res.status ==1){
                        layer.msg(res.msg,{icon:1,time:1500},function () {
                            location.reload();
                        });
                    }else{
                        layer.alert(res.msg,function (index) {
                            layer.close(index);
                        })
                    }
                }
            })

        });
    }


</script>

{/block}